  /*List*/
  
  var bangdanScroller;
  var bangdanPage=2;
	$.ui.ready(function () {
		bangdanScroller = $("#bangdan_panel").scroller(); //Fetch the scroller from cache
		//Since this is a App Framework UI scroller, we could also do
		// bangdanScroller=$.ui.scrollingDivs['webslider'];
		bangdanScroller.addInfinite();
		bangdanScroller.addPullToRefresh();
		bangdanScroller.runCB=true;
		
		/*下拉的时候触发的事件*/
		var hideClose;
		$.bind(bangdanScroller, "refresh-release", function () {
			var that = this;
			console.log("Refresh release");
			clearTimeout(hideClose);
			hideClose = setTimeout(function () {
				console.log("hiding manually refresh");
				that.hideRefresh();
			}, 1000);
			return false; //tells it to not auto-cancel the refresh
		});	
	
		bangdanScroller.enable();
		
		//解决 一个page可能请求多次的问题
		var flagBangdanScroller=true;		
	
		/*上拉的时候触发的事件*/
		$.bind(bangdanScroller, "infinite-scroll", function () {
			var self = this;
			console.log("正在加载中......");
			/*上拉更新加载多次*/
			if($(self.el).find("#infinite1").length==0){
         	 $(this.el).append("<div id='infinite1' style='border:2px solid black;margin-top:10px;width:100%;height:20px'>Fetching content...</div>");
     	   }
			
			
			$.bind(bangdanScroller, "infinite-scroll-end", function () {
				$.unbind(bangdanScroller, "infinite-scroll-end");
				//self.scrollToBottom();
				
				$(self.el).find("#infinite1").remove();
				
				
				if(!flagBangdanScroller) return;
				
				flagBangdanScroller=false;
				
				
				/*请求服务器加载数据*/
				
				var bangdan_list='';
				$.jsonP({
					url: 'http://www.phonegap100.com/appapi.php?a=getThreadList&fid=2&page='+bangdanPage+'&callback=?',
					success: function(data) {
						
						var rel=data.result
						//panel				
						for (var i = 0; i < rel.length; i++) {
							bangdan_list+='<li><a href="#">'+bangdanPage+'--'+rel[i].subject+'</a></li>';
						}
						$("#bangdan_list").append(bangdan_list);
						bangdanPage++;			
									
						flagBangdanScroller=true;
						
						self.clearInfinite();
										
					}
				});	
				
				
				/*请求服务器加载数据 完成*/
								
				
			});
		});				
	});
	
	
	
  /*分类*/
  
  
  
var fenleiScroller;
var fenleiPage=2;
$.ui.ready(function () {
	fenleiScroller = $("#fenlei_panel").scroller(); //Fetch the scroller from cache
	//Since this is a App Framework UI scroller, we could also do
	// fenleiScroller=$.ui.scrollingDivs['webslider'];
	fenleiScroller.addInfinite();
	fenleiScroller.addPullToRefresh();
	fenleiScroller.runCB=true;
	
	/*下拉的时候触发的事件*/
	var hideClose;
	$.bind(fenleiScroller, "refresh-release", function () {
		var that = this;
		console.log("Refresh release");
		clearTimeout(hideClose);
		hideClose = setTimeout(function () {
			console.log("hiding manually refresh");
			that.hideRefresh();
		}, 500);
		return false; //tells it to not auto-cancel the refresh
	});	

	fenleiScroller.enable();
	//解决 一个page可能请求多次的问题
	var flagFenleiScroller=true;		
	
	/*上拉的时候触发的事件*/
	$.bind(fenleiScroller, "infinite-scroll", function () {
		var self = this;
		console.log("infinite triggered");
		/*出现多次Fetching content*/
		if($(self.el).find("#infinite2").length==0){
            $(this.el).append("<div id='infinite2' style='border:2px solid black;margin-top:10px;width:100%;height:20px'>Fetching content...</div>");
        }
		
		$.bind(fenleiScroller, "infinite-scroll-end", function () {
			$.unbind(fenleiScroller, "infinite-scroll-end");
			//self.scrollToBottom();
			
			$(self.el).find("#infinite2").remove();
			
			//解决 一个page可能请求多次的问题
			if(!flagFenleiScroller) return;
			//解决 一个page可能请求多次的问题
			flagFenleiScroller=false;
				
			
			/*请求服务器加载数据*/
				var fenlei_list='';
				$.jsonP({
					url: 'http://www.phonegap100.com/appapi.php?a=getThreadList&fid=44&page='+fenleiPage+'&callback=?',
					success: function(data) {
						
						var rel=data.result
						//panel				
						for (var i = 0; i < rel.length; i++) {
							fenlei_list+='<li><a href="#">'+fenleiPage+''+rel[i].subject+'</a></li>';
						}
						$("#fenlei_list").append(fenlei_list);	
						
						fenleiPage++;	
						flagFenleiScroller=true;
						self.clearInfinite();				
					}
				});	
			
			
			
			/*请求服务器加载数据 完成*/
							
			
		});
	});				
});